package com.rgp.servicedriveruser.controller;

import com.rgp.internalcommon.dto.ResponseResult;
import com.rgp.internalcommon.response.DriverCarResponse;
import com.rgp.servicedriveruser.pojo.DriverCarBindingRelationship;
import com.rgp.servicedriveruser.service.DriverCarBindingRelationshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * @author nhp
 * @version 1.0
 * @description TODO
 * @date 2024-04-16 21:06
 */
@RestController
public class DriverCarBindingRelationshipController {

    @Autowired
    private DriverCarBindingRelationshipService driverCarBindingRelationshipService;

    @PostMapping("/driver-car-binding-relationship/bind")
    public ResponseResult bind(@RequestBody DriverCarBindingRelationship driverCarBindingRelationship){
        return driverCarBindingRelationshipService.bind(driverCarBindingRelationship);
    }

    @PutMapping("/driver-car-binding-relationship/unbind")
    public ResponseResult unbind(@RequestBody DriverCarBindingRelationship bindingRelationship){
        return driverCarBindingRelationshipService.unbind(bindingRelationship);
    }

    @PostMapping("/drivers/by-carIds")
    public ResponseResult<List<DriverCarResponse>> getDriversByCarIds(@RequestBody List<String> carIds){
        return driverCarBindingRelationshipService.getDriversByCarIds(carIds);
    }
}